class Solution:
    def searchInsert(self, nums: List[int], target: int) -> int:
        n = len(nums)
        i=0
        for i in range(0,n):
            if nums[i-1]<target and nums[i]>=target:
                return i
            elif nums[n-1]<target:
                return n
            elif nums[0]>target:
                return 0
            elif nums[0]==target:
                return 0